﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using Entity;
using System.Web.Script.Services;
using Web.UI;
namespace Web.frontpage.SignUp.right
{
    public partial class moreSignUp : SignUpPage
    {
        BLL.ContestService contest = new BLL.ContestService();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string conId = Request.QueryString["conId"];
                if (!string.IsNullOrEmpty(conId))
                {
                    BoContests model = contest.getContest(conId);
                    this.ConName.Value = model.CON_NAME;
                    this.ConId.InnerText = conId;
                }
            }
        }
        [WebMethod]
        public static string CheckStuId(string StuId, string ConId)
        {
            BLL.ParticipantService participant = new BLL.ParticipantService();
            BLL.StudentService students = new BLL.StudentService();
            BoStudents studentsModel = students.GetModelByCode(StuId);
            //存在此学生
            if (studentsModel != null)
            {
                BoParticipants model = new BoParticipants();
                model.PAR_STUDENTS = studentsModel.STU_ID;
                model.PAR_CONTESTS = ConId;
                if (participant.CheckStuId(model) > 0)
                    return "{'resultjson':'1'}";
                else
                    return "{'resultjson':'0'}";
            }
            else
                return "{'resultjson':'2'}";
            
            
        }
        [WebMethod]
        public static string checkGroupName(string groupName,string ConId)
        {
            BLL.GroupsService group = new BLL.GroupsService();
            //不存在此组名
            if (!group.CheckGroupName(groupName, ConId))
            {
                return "{'resultjson':'1'}";
            }
            //存在此组名
            else
                return "{'resultjson':'0'}";
        }
    }
}